package com.acme.task5;

public class TextModifier {
	public static void main(String[] args) {
        if (args.length < 1) {
            System.err.println("wrong number of arguments");
        }

		String str = args[0];
        int delta = 0;
        StringBuffer result = new StringBuffer(str);
		for (int i = 0; i < str.length(); i++) {
			char charAtIndex = str.charAt(i);
            if (Character.isDigit(charAtIndex)) {
                result.deleteCharAt(i + delta);
                delta--;
            } else if (charAtIndex == '+' || charAtIndex == '-') {
                result.insert(i + delta, charAtIndex);
                delta++;
            }
		}
        System.out.println(result);

        //not so cool
//        for (int i = 0; i < str.length(); i++) {
//            char charAtIndex = str.charAt(i);
//            if (Character.isDigit(charAtIndex)) {
//                //do nothing
//            } else if (charAtIndex == '+' || charAtIndex == '-') {
//                System.out.print(charAtIndex);
//                System.out.print(charAtIndex);
//            } else {
//                System.out.print(charAtIndex);
//            }
//        }
//        System.out.println();
	}
}
